************* Do-file for: Study 1 Analysis         ****************
************* Date Modified: 09/09/2020             ****************
************* Created by: Adam D. Wolsky 	        ****************

clear
cd "/Users/adamwolsky/Dropbox/Vandy/Projects/Hypocrisy_Scandal/Analysis/Study1_Murphy/Data/"
use "study1_clean.dta"
set more off

/* download user-written command cibar; type "ssc install cibar"
   download user-written command outreg2; type "ssc install outreg2" */

/* In analyzing the balance between the samples and summary statistics, I use 
"dem_other_dummy" and "rep_other_dummy" which are dummy variables where strong, weak 
and leaners are coded as 1 and strong, weak, and leaning out-partisans and pure 
independents are coded as 0.  

In the analyses I use the dummy variable democrat or republican, which only include
partisans and leaners of the in-party and out-party, but exclude independents.  */


cd "/Users/adamwolsky/Dropbox/Vandy/Projects/Hypocrisy_Scandal/Analysis/Study1_Murphy/Logs/"

log using study1_log, replace name("Study 1 Log File")

********************************************************************************
**********************               Balance              **********************
********************************************************************************

mlogit expcond female edu black hisp asian age news dem_other_dummy rep_other_dummy, b(1)

********************************************************************************
**********************          Summary Statistics        **********************
********************************************************************************

summarize female high_ed age hisp black asian partisan dem_other_dummy rep_other_dummy

************************************   H1   ************************************

ttest reptherm if republican == 1, by(t2vt1)

************************************   H2   ************************************

ttest reptherm if republican == 1, by(t3vt2)

*********************************** Figure 1 ***********************************

cd "/Users/adamwolsky/Dropbox/Vandy/Projects/Hypocrisy_Scandal/Figures"

cibar reptherm if republican == 1, level(90) over(expcond) ciopts(lcolor(black) ///
msize(0)) baropts(lcolor(black) lwidth(.2) barw(.7)) ///
graphopts(legend(off) xlabel(1 "Scandal" 2 "Hypocrisy" 3 "Resignation") ///
xtitle("Experimental Condition", margin(t=2)) ytitle("Mean of Republican Party Thermometer") ///
yscale(range( 75)) ylabel(45(5)75) ysize(5) xsize(6))
graph export "fig1.pdf", replace as(pdf)

************************************   H3   ************************************

ttest demtherm if democrat == 1, by(t2vt1)

*********************************** Figure 3 ***********************************

cd "/Users/adamwolsky/Dropbox/Vandy/Projects/Hypocrisy_Scandal/Figures"

cibar demtherm if democrat == 1, level(90) over(t2vt1) ciopts(lcolor(black) ///
msize(0)) baropts(lcolor(black) lwidth(.2) barw(.7)) ///
graphopts(legend(off) xlabel(1 "Scandal" 2 "Hypocrisy") ///
xtitle("Experimental Condition", margin(t=2)) ytitle("Mean of Democratic Party Thermometer") ///
yscale(range( 75)) ylabel(45(5)75) ysize(5) xsize(6))
graph export "fig3.pdf", replace as(pdf)

********************************************************************************
**************************      Additional Tests       *************************
********************************************************************************

************************* Strength of Partisanship *****************************

* Extension of H1a/H1b

ttest reptherm if pid7 == 5, by(t2vt1)
ttest reptherm if pid7 == 6, by(t2vt1)
ttest reptherm if pid7 == 7, by(t2vt1)

* Extension of H2

ttest reptherm if pid7 == 5, by(t3vt2)
ttest reptherm if pid7 == 6, by(t3vt2)
ttest reptherm if pid7 == 7, by(t3vt2)

* Extension of H3

ttest demtherm if pid7 == 1, by(t2vt1)
ttest demtherm if pid7 == 2, by(t2vt1)
ttest demtherm if pid7 == 3, by(t2vt1)

***************************** News Consumption *********************************

* Extension of H1a/H1b

reg reptherm i.t2vt1##i.vclosenews if republican == 1
margins, at(t2vt1=(0(1)1) vclosenews=(0(1)1)) level(90)

* Extension of H2

reg reptherm i.t3vt2##i.vclosenews if republican == 1
margins, at(t3vt2=(0(1)1) vclosenews=(0(1)1)) level(90)

* Extension of H3

reg demtherm i.t2vt1##i.vclosenews if democrat == 1
margins, at(t2vt1=(0(1)1) vclosenews=(0(1)1)) level(90)

log close _all
